﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;
using PPAP.BO;

namespace PPAP.Web.Part
{
    public partial class FDApprovalVP : PageBase
    {
        PPARBO bo = new PPARBO();
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!Page.IsPostBack)
            {

                DataSet ds = bo.GetListForApprovalVP(CurrentUser.Id);
                AspNetPager2.RecordCount = ds.Tables[0].Rows.Count;
                dgList.DataSource = GetPageTable(ds.Tables[0], AspNetPager2.PageSize, AspNetPager2.CurrentPageIndex);
                dgList.DataBind();

            }
        }

        protected override void SkinControl()
        {

        }



        //状态显示
        public string ShowAuditStatus(string Status)
        {
            string result = "";
            result = "<span style='color:red'>已提交</span>";

            switch (Status.ToLower())
            {
                case "0":
                    result = "<span style='color:blue'></span>";
                    break;
                case "1":
                    result = "<span style='color:red'>PPAR created</span>";
                    break;
                case "2":
                    result = "<span style='color:red'>PPAR submitted</span>";
                    break;
                case "3":
                    result = "<span style='color:red'>Ready for sampling</span>";
                    break;
                case "4":
                    result = "<span style='color:red'>not ready for sampling</span>";
                    break;
                case "5":
                    result = "<span style='color:red'>PPAR circulating</span>";
                    break;
                case "6":
                    result = "<span style='color:blue'>PPAR released</span>";
                    break;
                case "7":
                    result = "<span style='color:blue'>PPAR decided</span>";
                    break;

                default:
                    result = "<span style='color:red'></span>";
                    break;
            }
            return result;
        }


        //状态显示
        public string ShowStatus(string Status)
        {
            string result = "";
            result = "";

            switch (Status.ToLower())
            {
                case "0":
                    result = "Create new PPAR";
                    break;
                case "1":
                    result = "edit";
                    break;
                case "2":
                    result = "sampling";
                    break;
                case "3":
                    result = "not ready for sampling";
                    break;
                case "4":
                    result = "Ready for sampling";
                    break;
                case "5":
                    result = "PPAR circulating";
                    break;
                case "6":
                    result = "PPAR released";
                    break;
                case "7":
                    result = "PPAR decided";
                    break;

                default:
                    result = "view";
                    break;
            }
            return result;
        }

        //状态显示
        public string ShowImage(string Status)
        {
            string result = "";
            result = "image/add.gif";

            switch (Status.ToLower())
            {
                case "0":
                    result = "image/add.gif";
                    result = "../Images/newimg/new.png";
                    break;
                case "1":
                    result = "image/edit.png";
                    result = "../Images/newimg/write.png";
                    break;
                case "2":
                    result = "image/show.gif";
                    result = "../Images/newimg/see.png";
                    break;
                case "3":
                    result = "image/show.gif";
                    result = "../Images/newimg/see.png";
                    break;
                case "4":
                    result = "image/show.gif";
                    result = "../Images/newimg/see.png";
                    break;
                case "5":
                    result = "image/show.gif";
                    result = "../Images/newimg/see.png";
                    break;
                case "6":
                    result = "image/show.gif";
                    result = "../Images/newimg/see.png";
                    break;
                case "7":
                    result = "image/show.gif";
                    result = "../Images/newimg/see.png";
                    break;

                default:
                    result = "image/show.gif";
                    result = "../Images/newimg/see.png";
                    break;
            }
            return result;
        }

        protected void btnSearch_Click(object sender, EventArgs e)
        {

        }

        protected void AspNetPager2_PageChanged(object sender, EventArgs e)
        {
            DataSet ds = bo.GetListForApprovalVP(CurrentUser.Id);
            AspNetPager2.RecordCount = ds.Tables[0].Rows.Count;
            dgList.DataSource = GetPageTable(ds.Tables[0], AspNetPager2.PageSize, AspNetPager2.CurrentPageIndex);
            dgList.DataBind();
        }
    }
}